home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / aztecnos.arc / GLOBAL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-19  |  3.3 KB  |  125 lines

  1. #ifndef    MAXINT16
  2.  
  3. /* Global definitions used by every source file.
  4.  * Some may be compiler dependent.
  5.  */
  6.  
  7. /* Indexes into binmode in files.c; hook for compilers that have special
  8.  * open modes for binary files
  9.  */
  10. #define    READ_BINARY    0
  11. #define    WRITE_BINARY    1
  12. extern char *Binmode[];
  13.  
  14. /* These two lines assume that your compiler's longs are 32 bits and
  15.  * shorts are 16 bits. It is already assumed that chars are 8 bits,
  16.  * but it doesn't matter if they're signed or unsigned.
  17.  */
  18. typedef long int32;        /* 32-bit signed integer */
  19. typedef unsigned short int16;    /* 16-bit unsigned integer */
  20. #define    uchar(x) ((unsigned char)(x))
  21. #define    MAXINT16 65535        /* Largest 16-bit integer */
  22.  
  23. #if    (sizeof(int (*)()) == 4)
  24. #define    LARGECODE    1
  25. #endif
  26.  
  27. #if    (sizeof(int *) == 4)
  28. #define    LARGEDATA    1
  29. #endif
  30.  
  31. /* Since not all compilers support structure assignment, the ASSIGN()
  32.  * macro is used. This controls how it's actually implemented.
  33.  */
  34. #ifdef    NOSTRUCTASSIGN    /* Version for old compilers that don't support it */
  35. #define    ASSIGN(a,b)    memcpy((char *)&(a),(char *)&(b),sizeof(b));
  36. #else            /* Version for compilers that do */
  37. #define    ASSIGN(a,b)    ((a) = (b))
  38. #endif
  39.  
  40. /* Define null object pointer in case stdio.h isn't included */
  41. #ifndef    NULL
  42. /* General purpose NULL pointer */
  43. #define    NULL (void *)0
  44. #endif
  45. #define    NULLCHAR (char *)0    /* Null character pointer */
  46. #define    NULLCHARP (char **)0    /* Null character pointer pointer */
  47. #define    NULLINT    (int *)0    /* Null integer pointer */
  48. #define    NULLFP     (int (*)())0    /* Null pointer to function returning int */
  49. #define    NULLVFP     (void (*)())0    /* Null pointer to function returning void */
  50. #define    NULLVIFP (void interrupt (*)())0
  51. #define    NULLFILE (FILE *)0    /* Null file pointer */
  52.  
  53.  
  54. #ifdef    MPU8080    /* Assembler routines are available */
  55. int16 hinibble(),lonibble(),hibyte(),lobyte(),hiword(),loword();
  56.  
  57. #else
  58.  
  59. /* Extract a short from a long */
  60. #define    hiword(x)    ((int16)((x) >> 16))
  61. #define    loword(x)    ((int16)(x))
  62.  
  63. /* Extract a byte from a short */
  64. #define    hibyte(x)    ((unsigned char)((x) >> 8))
  65. #define    lobyte(x)    ((unsigned char)(x))
  66.  
  67. /* Extract nibbles from a byte */
  68. #define    hinibble(x)    (((x) >> 4) & 0xf)
  69. #define    lonibble(x)    ((x) & 0xf)
  70.  
  71. #endif
  72.  
  73. /* Local subroutines */
  74. #if    defined(__STDC__) || defined (__TURBOC__)
  75.  
  76. int htoi(char *);
  77. long htol(char *);
  78. void rip(char *);
  79. int dirps(void);
  80. void restore(int);
  81. long ptol(void *);
  82. void *ltop(long);
  83. #if    !defined(__TURBOC__)
  84. char *strdup(const char *);
  85. #endif
  86.  
  87. #else
  88.  
  89. int htoi();
  90. long htol();
  91. void rip();
  92. int dirps();
  93. void restore();
  94. long ptol();
  95. void *ltop();
  96. #if    !defined(__TURBOC__)
  97. char *strdup();
  98. #endif
  99.  
  100. #endif    /* defined(__STDC__) || defined (__TURBOC__) */
  101.  
  102. #include <stdlib.h>
  103. #include <string.h>
  104.  
  105. #ifdef    AZTEC
  106. #define    rewind(fp)    fseek(fp,0L,0);
  107. #endif
  108.  
  109. #ifdef    __TURBOC__
  110. #define movblock(so,ss,do,ds,c)    movedata(ss,so,ds,do,c)
  111. #define outportw outport
  112. #define inportw inport
  113.  
  114. #else
  115.  
  116. /* General purpose function macros already defined in turbo C */
  117. #define    min(x,y)    ((x)<(y)?(x):(y))    /* Lesser of two args */
  118. #define    max(x,y)    ((x)>(y)?(x):(y))    /* Greater of two args */
  119. #define MK_FP(seg,ofs)    ((void far *) \
  120.                (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
  121. #endif    /* defined(__TURBOC __) */
  122.  
  123. #endif    /* MAXINT16 */
  124.  
  125.